#ifndef RENDER_H
#define RENDER_H

#include <allegro5/allegro.h>
#include <vector>

#include <boost/smart_ptr.hpp>
using boost::scoped_ptr;
using boost::shared_ptr;

#include "Globals.h"
#include "GameElement.h"
#include "BitmapDraw.h"
#include "Display.h"
#include "Arrow.h"

/*! \class Render
 *  \brief Updates the object images of the game on the display.
 *
 *  The change in position and change in form of the object is captured in this class.
 *  These are: dig dug, both forms of the monster, the soil and the harpoon.
 *  The images are updated and drawn in the appropriate position which simulates
 *  movement.
 *
 *  \author Jackline Atsango
 *  \author Jean Pierre Vieira Pereira
 *  \version 3
 *  \date 26 September 2012
 */

using namespace std;

class Render
{
    public:

/*! \fn Render
 *  \brief create an object from class Render
 *  \param bitmaps an image
 *  \param display
 */
        Render( shared_ptr<BitmapDraw > bitmaps, ALLEGRO_DISPLAY* display  ) ;

/*! \fn void initialise
 *  \brief sets the starting position of the game
 */
        void initialise();

/*! \fn ALLEGRO_BITMAP* get_MainImage
 *  \returns starting image of the program
 */
        ALLEGRO_BITMAP* get_MainImage();

/*! \fn void render_Man
 *  \brief updates dig dug's position depending on direction
 *  \param DigDug an object from Man
 */
        void render_Man(shared_ptr<Man > DigDug);

/*! \fn void render_Soil
 *  \brief updates the soil image
 *
 *  Places a hole image where dig dug has explored
 */
        void render_Soil();

/*! \fn void render_Arrow
 *  \brief updates the harpoon direction depending on the direction of dig dug
 *  \param arrow an object from Arrow
 */
        void render_Arrow(shared_ptr<Arrow > arrow);

/*! \fn void render_Monster
 *  \brief updates the monster movement depending on state and direction
 *  \param face_direction the direction of movement of the monster
 *  \param pos_x x coordinate
 *  \param pos_y y coordinate
 *  \param disembody the state of the monster
 */
        void render_Monster(int face_direction, float pos_x, float pos_y, bool disembody);

/*! \fn void render_Title
 *  \brief displays the title screen
 */
        void render_Title();

/*! \fn void render_LevelPass
 *  \brief displays the level completed screen after all the monsters are killed
 */
        void render_LevelPass();

/*! \fn void render_GameOver
 *  \brief displays the 'Game Over' screen after dig dug has no more lives
 */
        void render_GameOver();

/*! \fn void update_ArrowBitmap
 *  \brief updates the expanding and contracting action of the harpoon
 */
        void update_ArrowBitmap(shared_ptr<Arrow > arrow);

    private:
        vector<shared_ptr<GameElement > > _game_elements;
        vector<shared_ptr<GameElement > >::iterator _iter;

        shared_ptr<BitmapDraw > _bitmaps;
        shared_ptr<Arrow > _arrow;

        ALLEGRO_DISPLAY* _display;

        ALLEGRO_BITMAP *_MainImage;
        ALLEGRO_BITMAP *_ArrowImage;
        ALLEGRO_BITMAP *_TempImage;

        int _ID;

        int _face_direction;
        float _temp_pos_x;
        float _temp_pos_y;

        double _arrowExpand;
};

#endif // RENDER_H
